.message_reactions {
    overflow: hidden;
    user-select: none;

    .message_reaction {
        display: flex;
        padding: 1px 4px 1px 3px;
        box-sizing: border-box;
        min-width: 44px;
        cursor: pointer;
        color: var(--color-message-reaction-text);
        background-color: var(--color-message-reaction-background);
        border: 1px solid var(--color-message-reaction-border);
        border-radius: 21px;
        align-items: center;
        box-shadow: inset 0 0 5px 0 var(--color-message-reaction-shadow-inner);
        transition:
            transform 100ms linear,
            font-weight 100ms linear;

        &.reacted {
            color: var(--color-message-reaction-text-reacted);
            background-color: var(--color-message-reaction-background-reacted);
            border-color: var(--color-message-reaction-border-reacted);
            font-weight: var(--font-weight-message-reaction);
            box-shadow: none;
        }

        &:hover {
            background-color: var(--color-message-reaction-background-hover);
        }

        &:active {
            transform: scale(var(--scale-message-reaction-active));
        }

        + .reaction_button {
            visibility: hidden;
            pointer-events: none;
            padding: 4px 6px;
            height: 13px;
            border-radius: 21px;
            color: var(--color-message-reaction-button-text);
            background-color: var(--color-message-reaction-button-background);
            border: 1px solid var(--color-message-reaction-button-border);
            /* TODO: Eventually this space will be set on the message
               box, at least in part, but for now this preserves the
               space beneath the reactions area. */
            margin-bottom: 4px;

            &:hover {
                color: var(--color-message-reaction-button-text-hover);
                background-color: var(
                    --color-message-reaction-button-background-hover
                );
                border-color: var(--color-message-reaction-button-border-hover);
                box-shadow: inset 0 0 5px 0
                    var(--color-message-reaction-shadow-inner);
            }
        }

        .emoji {
            margin: 1px 3px;
            height: 17px;
            width: 17px;
            /* Preserve the emoji's dimensions, no
               matter what the flexbox does. */
            flex-shrink: 0;
            /* Don't inherit position: relative; from
               the base .emoji class. */
            position: static;
        }

        .emoji_alt_code {
            /* Apply the same margins as on graphical emoji. */
            margin: 1px 3px;
            /* Reset some properties from the base .emoji_alt_code
               class that aren't appropriate in a flexbox context. */
            position: static;
            /* Flexbox will handle baselines, so don't mess with the
               line-height. */
            line-height: inherit;
        }
    }

    .message_reaction_count {
        /* 90% works out here to 12.6px */
        font-size: 90%;
        /* No top and bottom margin; just allow
           flexbox to handle the vertical alignment. */
        margin: 0 3px;
        /* Set the 12.6px text on a 13px line;
           the goal is to have that 13px line
           center correctly on the vertical with
           the 17px-square emoji, resulting in
           2px of space above and below the
           reaction count/name. */
        line-height: 13px;
    }

    .message_reaction:hover .message_reaction_count {
        color: var(--color-message-reaction-button-text-hover);
    }

    & i {
        font-size: 1.3em;
        float: left;
        color: var(--color-message-reaction-button-text);
    }

    &:hover .message_reaction + .reaction_button {
        visibility: visible;
        pointer-events: all;
    }

    .reaction_button,
    .emoji-message-control-button-container {
        display: flex;
        align-items: center;
    }

    .reaction_button {
        & i {
            font-size: 1em;
        }

        &:hover i {
            color: var(--color-message-reaction-button-text-hover);
        }

        /* Configure the reaction button to appear if and only if there's an
           existing reaction to the message. We reference first-child
           rather than only-child because tooltips may be appended to
           the DOM after this element, whereas actual reactions are
           appended before it. */
        &:first-child {
            display: none;
        }

        &:hover {
            border: 1px solid var(--color-message-reaction-button-border-hover);
            background-color: var(
                --color-message-reaction-button-background-hover
            );
            cursor: pointer;
            opacity: 1;
            color: var(--color-message-reaction-button-text-hover);
        }

        .message_reaction_count {
            font-weight: 700;
            color: var(--color-message-reaction-button-text);
            margin-right: 0;
        }

        &:hover .message_reaction_count {
            color: var(--color-message-reaction-button-text-hover);
        }
    }
}

.active-emoji-picker-reference,
.active-playground-links-reference {
    visibility: visible !important;
    pointer-events: all !important;
    opacity: 1 !important;
}

.emoji-picker-popover {
    padding: 0;
    height: 370px;
    user-select: none;

    &.bottom .arrow {
        border-bottom-color: hsl(0deg 0% 93%);
    }

    &.top .arrow {
        border-top-color: hsl(0deg 0% 93%);
    }

    .emoji-popover {
        width: 250px;

        .reacted {
            background-color: hsl(195deg 50% 95%);
            border-color: hsl(195deg 52% 79%);
        }

        .emoji-popover-top {
            position: relative;

            padding: 8px 10px;
            margin-bottom: 0;

            background-color: hsl(0deg 0% 93%);

            border-radius: 3px 3px 0 0;

            .fa-search {
                position: absolute;
                color: hsl(0deg 0% 73%);
                top: 15px;
                left: 17px;
                z-index: 3;
            }

            .emoji-popover-filter {
                margin: auto;
                padding-left: 22px;
                width: calc(100% - 22px - 8px);
                font-size: 90%;
            }
        }

        .emoji-popover-category-tabs {
            /* Flex needed here to work around #7511 (90% zoom issues in firefox) */
            display: flex;
            background-color: hsl(0deg 0% 93%);
            width: 100%;
            box-sizing: border-box;
            overflow: hidden;

            .emoji-popover-tab-item {
                display: inline-block;
                padding-top: 8px;
                width: 25px;
                height: 25px;
                text-align: center;
                font-size: 16px;
                cursor: pointer;
                /* Flex needed here to work around #7511 (90% zoom issues in firefox) */
                flex-grow: 1;

                &.active {
                    background-color: hsl(0deg 0% 100% / 20%);
                }
            }
        }

        .emoji-popover-emoji-map,
        .emoji-search-results-container {
            padding: 0;
            position: relative;
            overflow: hidden auto;
            display: block;
            width: 247px;
            padding-left: 3px;
        }

        .emoji-search-results-container {
            height: 283px;

            .emoji-popover-results-heading {
                font-weight: 600;
                padding: 5px 3px 3px 5px;
                font-size: 17px;
            }
        }

        .emoji-popover-emoji-map {
            height: 250px;

            .emoji-popover-subheading {
                font-weight: 600;
                padding: 5px 3px;
            }
        }

        .emoji-popover-emoji {
            display: inline-block;
            margin: 0;
            padding: 6px;
            cursor: pointer;
            border-radius: 0.5em;
            height: 25px;
            width: 25px;

            &.reacted.reaction:focus {
                background-color: hsl(195deg 55% 88%);
                outline: none;
            }

            &:not(.reacted):focus {
                background-color: hsl(0deg 0% 93%);
                outline: none;
            }

            &.hide {
                display: none;
            }

            .emoji {
                top: 6px;
            }
        }
    }

    .emoji-showcase-container {
        position: relative;
        background-color: hsl(0deg 0% 93%);
        min-height: 44px;
        width: 250px;
        border-radius: 0 0 3px 3px;

        .emoji-preview {
            position: absolute;
            width: 32px;
            height: 32px;
            left: 5px;
            top: 6px;
            margin-top: 0;
        }

        .emoji-canonical-name {
            position: relative;
            top: 12px;
            margin-left: 50px;
            font-size: 16px;
            font-weight: 600;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
    }
}

.emoji_alt_code {
    position: relative;
    top: 4px;
    font-size: 0.8em;
    display: inline-block;
    vertical-align: top;
    margin: 0 1px 0 0;
    line-height: 1em;
}

.typeahead .emoji {
    top: 2px;
}
